package com.example.demo_day02.controller;

import com.example.demo_day02.pojo.TbAutomobile;
import com.example.demo_day02.service.AutomobileService;
import com.example.demo_day02.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/automobile")
public class AutomobileController {




    @Autowired
    private AutomobileService automobileService;


    @PostMapping("/automobile_finAll")
    public ResponseResult finAll() {
        return automobileService.automobile_finAll();
    }

    @PostMapping("/automobile_byId")
    public ResponseResult AutomobileById(@RequestParam Integer id) {
        return automobileService.automobile_byId(id);
    }

    @PostMapping("/update_automobile")
    public ResponseResult update(@RequestBody TbAutomobile tbAutomobile) {
        return automobileService.update_automobile(tbAutomobile);
    }

    @PostMapping("/add_automobile")
    public ResponseResult add(@RequestBody TbAutomobile tbAutomobile) {
        return automobileService.add_automobile(tbAutomobile);
    }

    @PostMapping("/delete_automobile")
    public ResponseResult delete(@RequestParam Integer id) {
        return automobileService.delete_automobile(id);
    }


}
